package cn.xinfei.xdecision.common.model.monitor.logger.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

/**
 * 操作日志 Base VO
 */
@Data
public class OperateLogBaseVO {

    @ApiModelProperty(value = "链路追踪编号", required = true, example = "7f3dd8f5c5ca40709d5a9149b5a8039e")
    @NotEmpty(message = "链路追踪编号不能为空")
    private String traceId;

    @ApiModelProperty(value = "用户id", required = true, example = "1024")
    @NotNull(message = "用户id不能为空")
    private Long userId;

    @ApiModelProperty(value = "操作模块", required = true, example = "组件中心")
    @NotEmpty(message = "操作模块不能为空")
    private String module;

    @ApiModelProperty(value = "操作名称", required = true, example = "创建引擎")
    @NotEmpty(message = "操作名称")
    private String name;

    @ApiModelProperty(value = "操作分类", required = true, example = "1", notes = "参见 OperateLogTypeEnum 枚举类")
    @NotNull(message = "操作分类不能为空")
    private Integer type;

    @ApiModelProperty(value = "请求方法名", required = true, example = "GET")
    @NotEmpty(message = "请求方法名不能为空")
    private String requestMethod;

    @ApiModelProperty(value = "请求地址", required = true, example = "/xxx/yyy")
    @NotEmpty(message = "请求地址不能为空")
    private String requestUrl;

    @ApiModelProperty(value = "用户 IP", required = true, example = "127.0.0.1")
    @NotEmpty(message = "用户 IP 不能为空")
    private String userIp;

    @ApiModelProperty(value = "Java 方法的参数")
    private String javaMethodArgs;

    @ApiModelProperty(value = "开始时间", required = true)
    @NotNull(message = "开始时间不能为空")
    private LocalDateTime startTime;

    @ApiModelProperty(value = "执行时长，单位：毫秒", required = true)
    @NotNull(message = "执行时长不能为空")
    private Integer duration;

    @ApiModelProperty(value = "结果码", required = true)
    @NotNull(message = "结果码不能为空")
    private String resultCode;

    @ApiModelProperty(value = "结果提示")
    private String resultMsg;

    @ApiModelProperty(value = "结果数据")
    private String resultData;

    @ApiModelProperty(value = "操作人名称")
    private String createUserName;

    @ApiModelProperty(value = "操作人手机号")
    private String createUserMobile;

}
